using System;
using System.Data;
using System.IO;
using System.Xml;

namespace FreeFlow.Client
{
  /// <summary>
  /// Base abstract class for anything that needs to connect to the engine
  /// </summary>
  [Serializable]
  public abstract class Connectable 
  {
    private Connection connection;
    /// <summary>
    /// Gets or sets the connection.
    /// </summary>
    public virtual Connection Connection
    {
      get {	return connection; }
      set { connection = value; }
    }

    /// <summary>
    /// Checks the connection is valid and logged in.
    /// </summary>
    protected void CheckConnection()
    {
      if (Connection == null)
        throw new FreeFlowException("Connection property has not been set");

      if (!Connection.LoggedIn)
        throw new FreeFlowException("Connection is not logged in"); 
    }
	}
	
  /// <summary>
  /// Base abstract class for anything that needs to be refreshed 
  /// </summary>
  [Serializable]
	public abstract class Refreshable : Connectable
	{
    /// <summary>
    /// Refreshes the items in the class. Must be overridden in any inherited classes
    /// </summary>
		public abstract void RefreshItems();
	}
}
